<template>
  <div>
    <div class="rb issuerOne">
      <div class="leftB row">
        <div class="num center">
          <i class="el-icon-collection-tag"></i>
        </div>
        <div class="main">
          <div
            class="bookName pointer"
            @click="goIssuerHome(issure.userInfo.userId)"
          >
            {{ issure.StoreInfo.storeName }}
            <i
              v-for="(item, index) in issure.StoreInfo.starsNum"
              :key="'stars' + index"
              >⭐
            </i>
          </div>
          <div class="row messB">
            <div class="imgB center">
              <!-- :src="`${url}+${issure.userInfo.ppictureAddr}`" -->
              <img
                class="ppictureAddr"
                :src="url + issure.userInfo.ppictureAddr"
                alt=""
              />
            </div>
            <div class="message">
              <div class="iHead">
                <i class="issuerName">issuer</i
                ><i>{{ issure.userInfo.address }}</i>
              </div>
              <div class="iMain">
                <i class="like">好评:{{ issure.goodNum }}</i
                ><i class="finished">收藏:{{ issure.likeNum }}</i
                ><i class="count">总计{{ issure.count }}单</i>
              </div>
              <div class="iBottom">{{ issure.StoreInfo.labels }}</div>
            </div>
          </div>
        </div>
      </div>
      <div class="books row">
        <template v-for="item in newBookList">
          <div class="bookList" @click="goBookInfo(item.bookId)">
            <div class="coverPhoto center">
              <img class="img" :src="url + item.coverPhoto" alt="" />
            </div>
            <div class="bookName">{{ item.bookName }}</div>
            <div class="price">{{ item.fprice }}</div>
          </div>
        </template>
      </div>
    </div>
  </div>
</template>
<script>
export default {
  data() {
    return {
      IssureInfo: {},
      url: localStorage.getItem("url"),
    };
  },
  props: ["issure"],
  computed: {
    newBookList() {
      return this.issure.bookList.slice(0, 5);
      //在这里调用 created 里面的函数
    },
  },
  mounted() {
    console.log("url:", this.url);
  },
  methods: {
    goBookInfo(bookId) {
      this.$router.push({ path: "/details", query: { bookId: bookId } });
    },
    goIssuerHome(userId) {
      this.$router.push({ path: "/issuerHome", query: { userId: userId } });
    },
  },
};
</script>

<style lang="less" scoped>
.issuerOne {
  border-bottom: 1px solid lightslategrey;
  margin-top: 16px;
  margin-bottom: 20px;
  padding-bottom: 14px;
}
.leftB {
  .num {
    width: 100px;
    i {
      font-size: 50px;
      color: aqua;
    }
  }
  .main {
    .bookName {
      font-size: 14px;
      color: lightslategray;
      line-height: 2;
      margin-bottom: 10px;
    }
    .messB {
      .imgB {
        margin-right: 10px;
        width: 100px;
        height: 100px;
        .ppictureAddr {
          max-width: 100px;
          max-height: 100px;
        }
      }
      .message {
        font-size: 12px;
        color: rgb(161, 156, 156);
        line-height: 2.4;
        margin-left: 10px;
        .iHead {
          .issuerName {
            margin-right: 20px;
          }
        }
        .iMain {
          .like {
            margin-right: 20px;
          }
          .finished {
            margin-right: 20px;
          }
        }
        .iBottom {
          display: inline;
          padding: 4px 6px;
          background: rgb(233, 223, 223);
          font-size: 14px;
        }
      }
    }
  }
}

.books {
  line-height: 2;
  font-size: 12px;
  text-align: center;
  .bookList {
    margin-right: 10px;
    .coverPhoto {
      width: 100px;
      .img {
        width: 70px;
        height: 70px;
      }
    }
    .bookName {
      max-width: 100px;
      text-overflow: ellipsis;
      overflow: hidden; /* 超出隐藏 */
      white-space: nowrap; /* 强制一行显示 */
      color: lightslategrey;
    }
    .price {
      color: lightcoral;
    }
  }
  .bookList:hover {
    background: lightgrey;
    .img {
      width: 80px;
      height: 80px;
    }
  }
}
</style>